<!DOCTYPE html>
<html lang="en" >
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>getElementByTagName演示文档</title>
   <style>
   body{
    background-size: 100%;
    background-color: aqua;
   }
  
   </style>
  </head>
  <body onclick="myclick()">
    
<p>ssssssssssssssssssssss</p>
<p>ssssssssssssssssssssss</p>
<p>ssssssssssssssssssssss</p>
<p>ssssssssssssssssssssss</p>
<p>ssssssssssssssssssssss</p>
</body>
  <script>
    var tags = document.getElementsByTagName("body");
    // var D=1;
    
// var imgArr=["https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi0.hdslb.com%2Fbfs%2Farticle%2Fce03eed872f0a08e6b9e9958e64d8cdaad291c3f.jpg&refer=http%3A%2F%2Fi0.hdslb.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668772570&t=a6ccda45550be4e597c89245fe5b6094",

// "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.nga.178.com%2Fattachments%2Fmon_201807%2F29%2F-39t2Q5-fzxZ2cT3cS1hc-u0.jpg&refer=http%3A%2F%2Fimg.nga.178.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668772635&t=3ddd2becbe71eb527ca35c7bd5bfa142",

// "https://i0.hdslb.com/bfs/article/57fdaebc289cbc158a6f45d65491e4e3f91f36fc.jpg@942w_531h_progressive.webp",

// "https://i0.hdslb.com/bfs/article/694f07929f1f0e1064300199d8fc5530e1d13a6e.jpg@942w_531h_progressive.webp"];

function myclick(){
      const element = tags[0];
      document.element.style.backgroundImage="url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi0.hdslb.com%2Fbfs%2Farticle%2Fce03eed872f0a08e6b9e9958e64d8cdaad291c3f.jpg&refer=http%3A%2F%2Fi0.hdslb.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668772570&t=a6ccda45550be4e597c89245fe5b6094')";
       if(D==2){
       document.tags.backgroundImage="url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi0.hdslb.com%2Fbfs%2Farticle%2Fce03eed872f0a08e6b9e9958e64d8cdaad291c3f.jpg&refer=http%3A%2F%2Fi0.hdslb.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668772570&t=a6ccda45550be4e597c89245fe5b6094')";}
       if(D==3){
       document.tags.backgroundImage="url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi0.hdslb.com%2Fbfs%2Farticle%2Fce03eed872f0a08e6b9e9958e64d8cdaad291c3f.jpg&refer=http%3A%2F%2Fi0.hdslb.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668772570&t=a6ccda45550be4e597c89245fe5b6094')";}
       if(D==4){
         document.tags.backgroundImage="url("+imgArr[3]+")";
         D=0;
      }
    }
  
  </script>
</html>